SidClaw

Client

Initialize and configure the AgentIdentityClient for communicating with the SidClaw API.

AgentIdentityClient

The AgentIdentityClient is the main entry point for the SDK. It handles authentication, request retries, and communication with the SidClaw API.

Import

import { AgentIdentityClient } from '@sidclaw/sdk';

Constructor

const client = new AgentIdentityClient(config: ClientConfig);

ClientConfig

PropertyTypeRequiredDefaultDescription
apiKeystringYes--Your SidClaw API key (e.g., sk_live_...)
apiUrlstringYes--Base URL of the SidClaw API
agentIdstringYes--The registered agent ID this client acts on behalf of
maxRetriesnumberNo3Maximum retries for transient failures (5xx and network errors)
retryBaseDelayMsnumberNo500Base delay in milliseconds for exponential backoff

Example

import { AgentIdentityClient } from '@sidclaw/sdk';

const client = new AgentIdentityClient({
  apiKey: process.env.SIDCLAW_API_KEY!,
  apiUrl: 'https://api.sidclaw.com',
  agentId: 'ag_customer-support-bot',
});

Methods

The client exposes three methods:

MethodDescription
evaluate(action)Evaluate an action against the policy engine
waitForApproval(id, options?)Poll for an approval decision
recordOutcome(traceId, outcome)Record the result after executing an action

Retry Behavior

The client automatically retries requests that fail due to:

  • 5xx server errors -- retried with exponential backoff and jitter
  • Network errors -- retried with exponential backoff and jitter
  • 429 rate limit errors -- retried after the Retry-After header duration

Client errors (4xx other than 429) are not retried and throw immediately.

The backoff formula is:

delay = retryBaseDelayMs * 2^attempt * jitter

Where jitter is a random multiplier between 0.5 and 1.5.

Authentication

The client sends your API key in the Authorization header as a Bearer token on every request:

Authorization: Bearer sk_live_...

No additional authentication setup is required.


Python

SidClaw (sync)

from sidclaw import SidClaw

client = SidClaw(
    api_key="ai_...",
    base_url="https://api.sidclaw.com",  # default
    agent_id="your-agent-id",
)

AsyncSidClaw (async)

from sidclaw import AsyncSidClaw

async with AsyncSidClaw(
    api_key="ai_...",
    agent_id="your-agent-id",
) as client:
    decision = await client.evaluate({...})

Constructor Parameters

ParameterTypeRequiredDefaultDescription
api_keystrYes--Your SidClaw API key (e.g., ai_...)
base_urlstrNohttps://api.sidclaw.comBase URL of the SidClaw API
agent_idstrYes--The registered agent ID this client acts on behalf of
max_retriesintNo3Maximum retries for transient failures (5xx and network errors)
timeoutfloatNo30.0Request timeout in seconds

Methods

The Python client exposes the same three methods:

MethodDescription
evaluate(action)Evaluate an action against the policy engine
wait_for_approval(id, **options)Poll for an approval decision
record_outcome(trace_id, outcome)Record the result after executing an action

The AsyncSidClaw client provides async versions of all methods and supports use as an async context manager.


Framework Integrations

The AgentIdentityClient is the foundation for all SidClaw integrations. For framework-specific wrappers, see:

  • NemoClawgovernNemoClawTools() for NVIDIA NemoClaw sandboxes
  • MCPGovernanceMCPServer proxy for any MCP server
  • LangChaingovernTools() wraps LangChain tool arrays
  • OpenAI AgentsgovernOpenAITool() for function tools
  • All integrations — Complete list